<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model backend\modules\home\models\MhArticle */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="mh-article-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'cid')->dropDownList(['0'=>'无']) ?>

    <?= $form->field($model, 'type')->dropDownList(['0'=>'单页面','1' => '分类']) ?>

    <?= $form->field($model, 'title')->textInput(['maxlength' => true])->label('文章标题 ：<span style="color:red;">[ 必填 ]</span>') ?>

    <?= $form->field($model, 'summary')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'author')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'read')->textInput() ?>

    <?= $form->field($model, 'tag')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'order')->textInput()->label('排序 ：<span style="color:red;">[ 数字越大越排序越靠前 ]</span>') ?>

    <!-- <?= $form->field($model, 'image_path')->textInput(['maxlength' => true]) ?> -->

    <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'content')->widget('common\widgets\ueditor\Ueditor',[
        'options'=>[
            'initialFrameWidth' => 850,
        ]
    ]) ?>

    <?= $form->field($model, 'status')->dropDownList(['1'=>'发布中','0'=>'未发布']) ?>

    <?php if(!$model->publish_date){ ?>
    <?= $form->field($model, 'publish_date')->textInput(['maxlength' => true, 'type' => 'date', 'value' => date('Y-m-d')]) ?>
    <?php }else{ ?>
    <?= $form->field($model, 'publish_date')->textInput(['maxlength' => true, 'type' => 'date']) ?>
    <?php }?>


    <div class="form-group">
        <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
